import Vue from 'vue'
import VueRouter from 'vue-router'
//导入一级路由
import Login from "../views/login"
import Layout from "../views/layout"

Vue.use(VueRouter)

const routes = [
  {path:"/",redirect:"/login"},
  {path:"/login",component:Login},
  {path:"/home",meta:{title:"首页"},component:Layout,redirect:"/home",children:[
    {path:"",component:()=>import("../views/home/index.vue")}
  ]},
  //用户管理
  {path:"/users",meta:{title:"用户管理"},component:Layout,redirect:"/users",children:[
    {path:"users",meta:{title:"用户列表"},component:()=>import("../views/users/index.vue")}
  ]},
  //权限管理
  {path:"/rights",meta:{title:"权限管理"},component:Layout,redirect:"/rights/roles",children:[
    {path:"roles",meta:{title:"角色列表"},component:()=>import("../views/auth/role.vue")},
    {path:"rights",meta:{title:"权限列表"},component:()=>import("../views/auth/right.vue")}
  ]},
  //商品管理
  {path:"/goods",meta:{title:"商品管理"},component:Layout,redirect:"/goods",children:[
    {path:"goods",meta:{title:"商品列表"},component:()=>import("../views/goods/goods.vue")},
    {path:"params",meta:{title:"分类参数"},component:()=>import("../views/goods/params.vue")},
    {path:"categories",meta:{title:"商品分类"},component:()=>import("../views/goods/categories.vue")},
    {path:"goodsJump",meta:{title:"商品添加"},component:()=>import("../views/goods/goodsJump.vue")} 
  ]},
  //订单管理
  {path:"/orders",meta:{title:"订单管理"},component:Layout,redirect:"/orders",children:[
    {path:"orders",meta:{title:"订单列表"},component:()=>import("../views/orders/index.vue")}
  ]},
  //数据统计
  {path:"/reports",meta:{title:"数据统计"},component:Layout,redirect:"/reports",children:[
    {path:"reports",meta:{title:"数据报表"},component:()=>import("../views/reports/index.vue")}
  ]},
]

const router = new VueRouter({
  routes
})

export default router
